/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package mathma.core.real.form.cond;

import mathma.core.bool.BooleanValue;

import mathma.core.cond.Conditional;

import mathma.core.expr.Expression;

import mathma.core.real.Real;

import java.util.ArrayList;
import java.util.List;

/**
 * @since 0.2.5
 * @author Ethan Levine
 */
public class EqualityConditional extends Conditional<Real> {

    private final Expression<Real> firstExpr;
    private final Expression<Real> secondExpr;

    public EqualityConditional(Expression<Real> firstExpr,
            Expression<Real> secondExpr) {
        super();
        this.firstExpr = firstExpr;
        this.secondExpr = secondExpr;
    }

    public BooleanValue evaluate() {
        return null;
        // TODO -- implement equality conditional
    }

    public List<Expression<Real>> getOperands() {
        List<Expression<Real>> operands = new ArrayList<Expression<Real>>();
        operands.add(firstExpr);
        operands.add(secondExpr);
        return operands;
    }

    public EqualityConditional newInstance(List<Expression<Real>> operands) {
        if (operands.size() == 2) {
            return new EqualityConditional(operands.get(0), operands.get(1));
        } else {
            throw new IllegalArgumentException(
                    "Invalid operands to EqualityConditional.newInstance.");
        }
    }
}
